<template>
	<!--教师 考试已发布 考试库 -->
	<page-body>
		<view class="page">
			<view class="flex benben-position-layout flex flex-wrap align-center flex_0_ibhf"
				:style="{height:(88+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
			 <view class='flex flex-wrap align-center justify-between flex-sub fd0_0_ibhf'>
					<view class='flex flex-wrap align-center fd0_0_c0_ibhf' @tap.stop="back" >
						<text class='fu-iconfont2  fd0_0_c0_c0_ibhf'>&#xE794;</text>
					</view>
					<view class='flex flex-wrap align-stretch justify-center'>
						<text class='fd0_0_c1_c0_ibhf'>{{name}}</text>
					</view>
					<view class='flex flex-wrap align-center justify-end fd0_0_c0_ibhf'>
					</view>
				</view>

			</view>
			<view :style="{height: (88+StatusBarRpx)+'rpx'}"></view>
			<!---flex布局flex布局开始-->
			<view class="flex flex-direction align-stretch benben-flex-layout">
			
				<view class='flex flex-direction align-stretch fd1_1_ibhf' >
					<template v-for='(item,key0) in list' v-if="list.length>0 ">
						<view class='flex flex-wrap align-center justify-between fd1_1_c0_ibhf' :key='key0'
							@tap.stop="jump(item,key0)">
							<view class='flex flex-direction  align-stretch justify-between flex-sub'>
								<view class="">
									<image v-if="item.is_dir==1" style="width: 48rpx;height: 41rpx;margin-right: 20rpx;" src="/static/images/dir.png" mode=""></image>
									<text class='fd1_1_c0_c0_c0_ibhf'>{{item.is_dir==0?item.title:item.name}}</text>
								</view>
								<text class='fd1_1_c0_c0_c1_ibhf' v-if=" tab=='2'">创建时间:{{item.create_time}}</text>
							</view>
							<view class='flex flex-wrap align-center'>
								<text class='fu-iconfont2'>&#xe7f2;</text>
							</view>
						</view>
					</template>
				</view>
			</view>
			<view v-if="list.length==0 && isup">
				<slot>
					<view class="public-page-empty">
						<image src='/static/global/order.png'></image>
						<view class="txt">暂无数据</view>
					</view>
				</slot>
			</view>
			<!---flex布局flex布局结束-->


		</view>
	</page-body>
</template>
<script>
	import pagingList from '@/common/mixin/paging_list.js';
	export default {
		components: {},
		mixins: [pagingList],

		data() {
			return {
				"tabsInfofd1_0": {
					lineleft: '',
					lineWidth: '',
					moveX: 0,
					scrollX: 0,
					PageScrollX: 0,
					isInit: false
				},
				"tab": "2",
				"list": [],
				isup: false,
				name: '', //文件夹名字
				type: 0, //1 课前预习  2课后作业 3课程考试
				id: '', //课程id
				"minixPagingListsApi": "",
				"pageingListApiMethod": "",
				"allowOnloadGetList": false,
				course:'',//课程id
				aid:'',//上一页面的aid
				pid:'',//当前展示上一级的aid
				pname:'',//当前展示上一级的name
				exampaperdir_id:'',//试卷目录ID文件夹id
				arrid:'',//记录跳转页面目录id
			};
		},
		computed: {

		},
		watch: {},
		onLoad(options) {
			this.course = options.course
			this.name = options.name
			this.exampaperdir_id = options.aid
			this.aid=options.aid
			this.getlist()
			if (global.appTabBarType) this.toHomeDiy()
		},
		onUnload() {
			
		},
		onReady() {

		},
		onShow() {

		},
		onHide() {

		},
		onResize() {

		},
		onPullDownRefresh() {
			this.getlist()
		},
		onReachBottom(e) {

		},
		onPageScroll(e) {

		},
		methods: {
			async getlist() {
				this.isup =false
				let datadatum = await this.$api.post(global.apiUrls.post68f9cbf47dd3d, {
					course_id: this.course,
					exampaperdir_id:this.exampaperdir_id
				});
				this.isup = true
				if (datadatum.data.code != 1) {
					this.$message.info(datadatum.data.msg);
					return
				}
				let infodatum = datadatum.data;
				this.list = infodatum.data
				
			},
			back(){
				if(!this.arrid || this.exampaperdir_id==this.aid){
					uni.navigateBack()
				}else{
					this.arrid=this.arrid.slice(0, -1)
					let arr=this.arrid.split(',')
					let newitem =arr[arr.length - 1]
					this.exampaperdir_id=newitem.split('/$$')[0]
					this.name=newitem.split('/$$')[1]
					let str =',' + newitem;
					this.arrid = this.arrid.replace(str, "");
					this.arrid =this.arrid +','
					this.list=[]
					this.getlist()
				}
			},
			jump(item, index) {
				if(item.is_dir==1){
					// 前进一页面追加一条数据
					this.arrid+=this.exampaperdir_id+'/$$'+this.name+','
					this.exampaperdir_id=item.aid
					this.name=item.name
					this.list=[]
					this.getlist()
				}else{
					uni.navigateTo({
						url: "/pages/kc/teacherkhzydetail/teacherkhzydetail?id=" + item.aid + '&name=' + item.title +'&course=' + this.course + '&type=3'
					})
				}

			},
		}
	};
</script>
<style lang="scss" scoped>
	.page {
		width: 100vw;
		overflow-x: hidden;
		min-height: calc(100vh - var(--window-bottom));
		background: rgba(255, 255, 255, 1);
		background-size: 100% auto;

		.checkTitlefd1_0_ibhf {
			font-weight: 700 !important;
			font-size: 28rpx !important;
			color: #333 !important;
			background-color: rgba(255, 255, 255, 1) !important;
		}

		.linefd1_0_ibhf {
			width: 40rpx;
			height: 8rpx;
			top: 80rpx;
			background: #145efd;
			background-size: 100% auto !important;
			border-radius: 4rpx;
		}

		.fd1_1_ibhf {
			padding: 0rpx 24rpx 0rpx 24rpx;
		}

		.fd1_1_c0_ibhf {
			border-bottom: 1px solid #eee;
			padding: 24rpx 0rpx 24rpx 0rpx;
		}

		.fd1_1_c0_c0_c0_ibhf {
			font-size: 32rpx;
			margin: 0rpx 0rpx 24rpx 0rpx;
		}

		.fd1_1_c0_c0_c1_ibhf {
			font-size: 24rpx;
			color: #999999;
		}
		.dpy{
			color:#EE8231 ;
		}

		.flex_0_ibhf {
			width: 750rpx;
			height: 88rpx;
			overflow: hidden;
			z-index: 10;
			top: 0rpx;
			background: #fff;
			background-size: 100% auto !important;

			.fd0_0_ibhf {
				padding: 0rpx 32rpx 0rpx 32rpx;

				.fd0_0_c1_c0_ibhf {
					font-size: 36rpx;
					font-weight: 700;
					color: #333333;
					line-height: 50rpx;
				}
			}
		}

		.fd0_0_c0_ibhf {
			width: 120rpx;

			.fd0_0_c0_c0_ibhf {
				font-size: 36rpx;
				color: #333;
			}
		}
	}

	::v-deep .benbenTabsfd1_0_ibhf {
		width: 750rpx;
		height: 90rpx;
		white-space: nowrap;
		background: #fff;
		text-align: center;
	}

	.public-page-empty {
		display: flex;
		justify-content: center;
		flex-direction: column;
		align-items: center;
		padding: 120upx 0 0 0;

		image {
			width: 300rpx;
			height: 300rpx;
		}

		.txt {
			font-size: 28upx;
			color: $uni-text-color;
			text-align: center;
			line-height: 100upx;
			color: var(--benben-loading-color, #999999);
		}

		.loadTips {
			line-height: 30upx;
		}

		.btn {
			width: 260upx;
			height: 78upx;
			line-height: 78upx;
			background: linear-gradient(309deg, rgba(254, 49, 0, 1) 0%, rgba(255, 90, 16, 1) 100%);
			opacity: 1;
			border-radius: 44upx;
			font-size: 28upx;
			color: #fff;
			text-align: center;
			margin-top: 100upx;
		}
	}

	.flex_0_ibhf {
		width: 750rpx;
		height: 88rpx;
		overflow: hidden;
		z-index: 10;
		top: 0rpx;
		background: #fff;
		background-size: 100% auto !important;

		.fd0_0_ibhf {
			padding: 0rpx 32rpx 0rpx 32rpx;

			.fd0_0_c1_c0_ibhf {
				font-size: 36rpx;
				font-weight: 700;
				color: #333333;
				line-height: 50rpx;
			}
		}
	}
</style>
